﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using COFE.Core.Utils;

namespace COFE.Web.NetClient
{
    public class HttpNetClient : INetClient
    {
        public System.Net.WebResponse SendRequest(
            string uri, string method, System.IO.Stream sendStream = null)
        {
            HttpWebRequest request = WebRequest.Create(uri)
                        as HttpWebRequest;
            request.CookieContainer = _cookies;
            request.Method = method;
            if (sendStream != null)
                StreamUtils.CopyStream(sendStream, request.GetRequestStream());
            return request.GetResponse();
        }

        #region Data

        private CookieContainer _cookies = new CookieContainer(100);

        #endregion
    }
}
